package com.sgx.learning.luban.homework;

/**
 * 传化公路港物流有限公司 Copyright © 2020版权所有. Transfar All Rights Reserved.
 *
 * @ClassName: AccessFlagFormatUtils
 * @Prject: luban
 * @Package: com.sgx.learning.luban.homework
 * @Description: TODO
 * @author: 021495
 * @date: 2020/9/3 11:06
 */
public class AccessFlagFormatUtils {
    public static final short ACC_PUBLIC              = 0x0001;
    public static final short ACC_FINAL               = 0x0010;
    public static final short ACC_SUPER               = 0x0020;
    public static final short ACC_INTERFACE          = 0x0200;
    public static final short ACC_ABSTRACT           = 0x0400;
    public static final short ACC_SYNTHETIC          = 0x1000;
    public static final short ACC_ANNOTATION         = 0x2000;
    public static final short ACC_ENUM                = 0x4000;
    public static String getClassAccess(short accessFlags) {
        StringBuffer sb = new StringBuffer();
        if((accessFlags & ACC_PUBLIC) != 0) {
            sb.append("ACC_PUBLIC ");
        }
        if((accessFlags & ACC_FINAL) != 0) {
            sb.append("ACC_FINAL ");
        }
        if((accessFlags & ACC_SUPER) != 0) {
            sb.append("ACC_SUPER ");
        }
        if((accessFlags & ACC_INTERFACE) != 0) {
            sb.append("ACC_INTERFACE ");
        }
        if((accessFlags & ACC_ABSTRACT) != 0) {
            sb.append("ACC_ABSTRACT ");
        }
        if((accessFlags & ACC_SYNTHETIC) != 0) {
            sb.append("ACC_SYNTHETIC ");
        }
        if((accessFlags & ACC_ANNOTATION) != 0) {
            sb.append("ACC_ANNOTATION ");
        }
        if((accessFlags & ACC_ENUM) != 0) {
            sb.append("ACC_ENUM ");
        }
        return sb.toString();
    }
}
